home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Linux
/
Kubuntu 8.10
/
kubuntu-8.10-desktop-i386.iso
/
casper
/
filesystem.squashfs
/
usr
/
bin
/
ubuntu-bug
< prev
next >
Wrap
Text File
|
2008-10-20
|
2KB
|
57 lines
#!/bin/sh -e
args="$@"
# Do what I mean: if just specifying a single argument, it is a package name or
# PID
if [ "$#" = 1 ]; then
if test "$1" -gt 0 2>/dev/null; then
args="-P $1"
elif expr "$1" : ".*/.*" >/dev/null; then
output=$(dpkg-query --search "$1" || echo '')
if expr "$output" : ".*,.*" >/dev/null; then
echo "Path '$1' matches more than one package" >&2
exit 1
elif [ -z "$output" ]; then
echo "Path '$1' does not match any package" >&2
fi
package=${output%%:*}
args="-p $package"
else
args="-p $1"
fi
fi
# check for X
if [ -z "$DISPLAY" ]; then
if [ -x /usr/bin/apport-cli ]; then
/usr/bin/apport-cli -f $args
else
echo "\$DISPLAY is not set. You need apport-cli to make this program work." >&2
exit 1
fi
# do we have a running Gnome/KDE session
elif pgrep -u `id -u` -x gnome-session >/dev/null && \
[ -x /usr/share/apport/apport-gtk ]; then
/usr/share/apport/apport-gtk -f $args
elif pgrep -u `id -u` -x ksmserver >/dev/null && \
[ -x /usr/share/apport/apport-qt ]; then
/usr/share/apport/apport-qt -f $args
# fall back to calling whichever is available
elif [ -x /usr/share/apport/apport-gtk ]; then
/usr/share/apport/apport-gtk -f $args
elif [ -x /usr/share/apport/apport-qt ]; then
/usr/share/apport/apport-qt -f $args
elif [ -x /usr/bin/apport-cli ]; then
if [ -z "$TERM" ]; then
x-terminal-emulator -e /usr/bin/apport-cli -f $args
else
/usr/bin/apport-cli -f $args
fi
else
echo "Neither apport-gtk, apport-qt or apport-cli is installed. Install either to make this program work." >&2
exit 1
fi